home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Semaphore
/
Source
/
CSemaphorePicture.cp
< prev
next >
Wrap
Text File
|
2000-06-23
|
891b
|
40 lines
// CSemaphorePicture.cp
#include "CSemaphorePicture.h"
#include <ctype.h>
CSemaphorePicture::CSemaphorePicture(
LStream* inStream): LPicture(inStream)
{
}
CSemaphorePicture::~CSemaphorePicture()
{
// do nothing
}
// ---------------------------------------------------------------------------------
// • HandleKeyPress
// ---------------------------------------------------------------------------------
// Interpret key commands
Boolean
CSemaphorePicture::HandleKeyPress( const EventRecord& inKeyEvent)
{
int theKey = (unsigned char) inKeyEvent.message & charCodeMask;
int thePicture = 0;
if (theKey==' ') {
thePicture = 0;
} else if (('A' <= theKey) && (theKey <= 'Z')) {
thePicture = (theKey - int('A') + 1);
} else if (('a' <= theKey) && (theKey <= 'z')) {
thePicture = (theKey - int('a') + 101);
}
SetPictureID(thePicture);
Refresh();
return true;
}